{layout name="p/base"}
    <div class="row">
      <div class="col-lg-12">
        <h1>卡管理 <small>卡信息</small></h1>
        <ol class="breadcrumb">
          <li><a href="/manager/index"><i class="fa fa-dashboard"></i> 管理首页</a></li>
          <li><a href="/card/index"><i class="fa fa-dashboard"></i> 卡信息列表</a></li>
          <li class="active"><i class="fa fa-table"></i> 添加卡</li>
        </ol>
        <div class="alert alert-success alert-dismissable">
          <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
          添加卡信息 
        </div>
      </div>
    </div>
    <!-- /.row -->
    <div class="row">
      <div class="col-lg-12">
        <form class="form-horizontal" role="form" action="/card/addcard" method="post">
          <input type="hidden" name="caravan_id" value="{$id}">
            <div class="modal-header">
            <h4 class="modal-title" id="myModalLabel">
               添加卡信息
            </h4>
            </div>
            <div class="form-group">
              <label class="control-label col-sm-3">合同号</label>
              <div class="col-sm-9">
              <input class="form-control" type="text" name="contract_num" placeholder="请准备填写合同编号">
              </div>
            </div>
            <div class="form-group">
              <label class="control-label col-sm-3">营地名称</label>
              <div class="col-sm-9">
              <input class="form-control" type="text" name="camp_name" disabled="" value="{$caravan_info.camps.name}" placeholder="请正确填写营地名称">
              </div>
            </div>
            <div class="form-group">
              <label class="control-label col-sm-3">泊位号</label>
              <div class="col-sm-9">
              <input class="form-control" type="text" name="park_num" disabled="" value="{$caravan_info.park_num}" placeholder="请正确填写泊位号">
              </div>
            </div>
            <div class="form-group">
              <label class="control-label col-sm-3">房车编号</label>
              <div class="col-sm-9">
              <input class="form-control" type="text" name="number" disabled="" value="{$caravan_info.number}" placeholder="请正确填写房车编号">
              </div>
            </div>
            <div class="form-group">
              <label class="control-label col-sm-3"><span id="phoneerror">手机号码</label>
              <div class="col-sm-9">
                <input class="form-control" type="text" name="user_phone" placeholder="请填写购买人手机号码">
              </div>
            </div>
          </div>
          <div class="modal-footer">
            <input type="button" value="返回" class="btn btn-default"  onclick="javascript:history.back(-1);" />
            <button type="submit"  class="btn btn-primary">提交</button>
          </div>
        </form>
      </div>
    </div>

<script type="text/javascript" src="/jquery.js"></script>
<script src="/front/js/js.js"></script>
<script type="text/javascript">
  $(function(){
    //账号验证
    $("input[name='user_phone']").blur(function(){
      var user_phone = $('input[name="user_phone"]').val();
      //不能为空
      if(!$.trim(user_phone)) {
      $("input[name='user_phone']").css({border: "1px solid red"});
      $("#phoneerror").html("请输入手机号");
      return false;
      }
      //手机号格式是否满足
      if((/^1[3|4|5|7|8]\d{9}$/.test(user_phone)) || (/(^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+$)|(^$)/.test(user_phone))){
        $("input[name='user_phone']").css({border: "1px solid green"});
        $("#phoneerror").html("手机号");
      }else {
        $("input[name='user_phone']").css({border: "1px solid red"});
        $("#phoneerror").html("格式不正确");
        return false;
      }
    })
  })
</script>